import request from '@/utils/request'

// 查询用户列表
export function listData(query) {
  return request({
    url: '/data/user/',
    method: 'get',
    params: query
  })
}

// 查询select
export function getListAll(data) {
  return request({
    url: '/data/user/refer',
    method: 'get',
    params: data
  })
}

// 查询用户详细
export function getDetail(id) {
  return request({
    url: '/data/user/' + id,
    method: 'get'
  })
}

// 修改用户
export function updateData(data) {
  return request({
    url: '/data/user/',
    method: 'put',
    data: data
  })
}

// 冻结/解冻用户
export function delData(data) {
  return request({
    url: '/data/user/enable',
    method: 'put',
    params: data
  })
}


// 导入用户
export function importData(data) {
  return request({
    url: '/data/user/importUsers',
    method: 'post',
    data: data
  })
}

// 获取二维码
export function getCode(query) {
  return request({
    url: '/data/user/getRefereeCode',
    method: 'get',
    params: query
  })
}

// 绑定下级
export function bindChild(query) {
  return request({
    url: '/data/user/userBind',
    method: 'post',
    params: query
  })
}

export function removeChild(query) {
  return request({
    url: '/data/user/unbind',
    method: 'post',
    params: query
  })
}
//申请退押金
export function depositRefund(query) {
  return request({
    url: '/api/data/user/productReturn/applyDepositRefund',
    method: 'post',
    params: query
  })
}
//替换销售
export function replaceSell(query) {
  return request({
    url: '/data/user/replaceSell',
    method: 'POST',
    params: query
  })
}
//修改备注
export function remark(query) {
  return request({
    url: '/data/user/remark',
    method: 'POST',
    params: query
  })
}
//用户下拉
export function userList(query) {
  return request({
    url: '/data/user/refer/',
    method: 'GET',
    params:query
  })
}

//合并用户
export function mergeUser(query) {
  return request({
    url: '/data/user/mergeUser',
    method: 'POST',
    params: query
  })
}
//转移账户

export function transferAccount(query) {
  return request({
    url: '/data/user/transferAccount',
    method: 'POST',
    params: query
  })
}

//添加电话用户
export function addPhoneUser(query) {
  return request({
    url: '/data/user/insertByPhone',
    method: 'POST',
    params: query
  })
}


// 生成当前用户的绑定微信二维码
export function bindCode() {
  return request({
    url: '/data/user/createBindCode',
    method: 'GET',
  })
}


// 解绑
export function removeCode() {
  return request({
    url: '/data/user/userUnbind',
    method: 'GET',
  })
}

//获取未绑定用户
export function getNotBindList(query) {
  return request({
    url: '/data/user/notBind',
    method: 'get',
    params: query
  })
}
//获取已绑定用户
export function getBindList(query) {
  return request({
    url: '/data/user/endBind',
    method: 'get',
    params: query
  })
}

